using UnityEngine;

public class EnemyHitState : EnemyState
{
    public EnemyHitState(EnemyFSM manager, string animationName) : base(manager, animationName) { }

    public override void OnEnter()
    {
        base.OnEnter();

        

    }

    public override void OnUpdate()
    {
        base.OnUpdate();
        // 转换到死亡状态
        if (parameter.isDead)
        {
            manager.TransitionState(StateType.Death);
        }

        // 如果动画播放进度超过95%，重新寻找玩家目标并转换到追逐状态
        if (PlayComplete())
        {
            // parameter.target = GameObject.FindWithTag("Player").transform;    // 寻找标签为Player的目标

            manager.TransitionState(StateType.Chase);    // 转换到追逐状态
        }
    }

    public override void OnFixedUpdate()
    {
        base.OnFixedUpdate();
    }

    public override void OnExit()
    {
        base.OnExit();
        parameter.isHurt = false;    // 离开状态时重置受击标志
    }
}

